package com.whfc.ms.api.emp.controller;

import com.whfc.common.result.Result;
import com.whfc.common.result.ResultUtil;
import com.whfc.common.util.SessionAttr;
import com.whfc.emp.entity.AppSyncRealNameConfig;
import com.whfc.emp.param.AppEmpOuterParam;
import com.whfc.fuum.entity.SysUser;
import com.whfc.ms.api.emp.service.MsAppHelmetService;
import com.whfc.ms.api.emp.service.MsAppSyncRealNameConfigService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.io.IOException;
import java.util.List;

/**
 *筑邦智能
 */
@RestController
@RequestMapping("/ms/api/emp/syncRealNameConfig")
public class AppRealNameConfigController {
    private Logger logger = LoggerFactory.getLogger(this.getClass());

    @Autowired
    private MsAppSyncRealNameConfigService msAppSyncRealNameConfigService;

    /**
     * 添加实名制配置
     * @param user
     * @return
     */
    @PostMapping("/add")
    public Result add(@SessionAttribute(SessionAttr.MS_USER) SysUser user,@RequestBody AppSyncRealNameConfig request) throws IOException {
        logger.info("=====添加实名制配置：{}", request.toString());
        msAppSyncRealNameConfigService.add(request);
        return ResultUtil.success();
    }

    @PostMapping("/edit")
    public Result edit(@SessionAttribute(SessionAttr.MS_USER) SysUser user,@RequestBody AppSyncRealNameConfig request) throws IOException {
        logger.info("=====编辑实名制配置：{}", request.toString());
        msAppSyncRealNameConfigService.edit(request);
        return ResultUtil.success();
    }

    @PostMapping("/del")
    public Result del(@SessionAttribute(SessionAttr.MS_USER) SysUser user,@RequestBody AppSyncRealNameConfig request) throws IOException {
        logger.info("=====删除实名制配置：{}", request.toString());
        msAppSyncRealNameConfigService.del(request);
        return ResultUtil.success();
    }

    @PostMapping("/list")
    public Result list(@SessionAttribute(SessionAttr.MS_USER) SysUser user,@RequestBody AppSyncRealNameConfig request) throws IOException {
        logger.info("=====实名制配置列表：{}", request.toString());
        List<AppSyncRealNameConfig> list = msAppSyncRealNameConfigService.list(request);
        return ResultUtil.success(list);
    }
}
